package com.pzl.service.impl;

import com.pzl.mapper.RoleDao;
import com.pzl.entity.Role;
import com.pzl.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * RoleServiceImpl class
 *
 * @Author panzhenglei
 * @Date 2019/6/8 11:43 AM
 */


@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleDao roleDao;

    @Override
    public List<Role> findAll() {
        List<Role> role = roleDao.findAll();
        return role;
    }

    @Override
    public Long save(String roleName, String roleDesc) throws Exception {
        int i = roleDao.save(roleName, roleDesc);
        if (i>0){
            Long l = roleDao.selectId();
            return l;
        }
        return 0L;
    }


}
